/**
 * Created by zwsvane on 2017/9/13.
 */

//公平系数趋势详情部分
function gpxsqsDetial(siteId){
    $.ajax({
        'dataType':'json',
        'url':WEBURL+'/coefficientTrend/deliveryList',
        'data':{
            'relationId':siteId
        },
        success:function(r){
            if(r.code==0000){
                var gpxsqsDetialList = '';
                $("#gpxsqsDetialList").html(' ');
                if(r.data.length>0){
                    $.each(r.data,function (index, item) {
                        gpxsqsDetialList = gpxsqsDetialList+  '<tr class="text-c">'+
                            '<td>'+item.provinceName+'</td>'+
                            '<td>'+item.cityName+'</td>'+
                            '<td>'+item.siteName+'</td>'+
                            '<td>'+item.deliveryName+'</td>'+
                            '<td>'+item.orderEfficiencyNum+'</td>';
                        if(item.status==1){
                            gpxsqsDetialList =gpxsqsDetialList+ '<td><b class="redColor font-normal">新人保护</b></td>';
                        }else{
                            gpxsqsDetialList =gpxsqsDetialList+ '<td>'+sessionStorage.gpxsqsData+'</td>';
                        }

                        gpxsqsDetialList =gpxsqsDetialList+ '<td>'+item.orderCommonNum+'</td>'+
                            '<td>'+item.dxOrderNumAdjust+'</td>'+
                            '<td>'+item.batchOrderNumModify+'</td>'+
                            '<td>'+item.siteDate+'</td>'+
                            '</tr>';
                    })
                }
                else{
                    gpxsqsDetialList = '<tr class="text-c"><td colspan="10">暂无数据</td></tr>'
                }
                //console.log(gpxsqsDetialList);
                $(gpxsqsDetialList).appendTo($("#gpxsqsDetialList"))
            }
        },
        error:function(e){
            console.log(e.msg)
        }

    })

}

//公平系数趋势详情修改记录部分
function gpxsqsDetialLog(siteId){
    $.ajax({
        'dataType':'json',
        'url':WEBURL+'/coefficientTrend/siteLogList',
        'data':{
            'relationId':siteId
        },
        success:function(r){
            if(r.code==0000){
                var gpxsqsDetialLog = '';
                $("#gpxsqsDetialLog").html(' ');
                if(r.data.length>0){
                    $.each(r.data,function (index, item) {
                        gpxsqsDetialLog = gpxsqsDetialLog+  '<tr class="text-c"><td>'+item.modContent+'</td><td>'+item.operateTime+'</td></tr>';
                    })
                }
                else{
                    gpxsqsDetialLog = '<tr class="text-c"><td colspan="2">暂无数据</td></tr>'
                }

                $(gpxsqsDetialLog).appendTo($("#gpxsqsDetialLog"))
            }
        },
        error:function(e){
            console.log(e.msg)
        }

    })

}


$(function(){
   //初始化
    gpxsqsDetial(sessionStorage.gpxsqsSiteId);
    gpxsqsDetialLog(sessionStorage.gpxsqsSiteId);
})
